package model.scanner;
import model.scanner.JTwain;

import java.awt.Image;

import com.asprise.util.jtwain.Source;
import com.asprise.util.jtwain.SourceManager;

/*
 * $Id$
 * 
 */

public class Scanner extends JTwain{
	
	public Image Capturar() {
		Image image = null;
		try {
			Source source = SourceManager.instance().getDefaultSource();
			
			if(source == null) {
				error("There is no (default) source on the system!");
				return null;
			}
			
			source.open();
			
			image = source.acquireImage();
						
			source.close();
			return image;
		}catch(Exception e) {
			exception(e);
		}finally{
			SourceManager.closeSourceManager();
		}
		return image;
	
	}
	
}
